{% extends 'base.html' %}

{% block content %}
<div class="container mt-4">
    <h2>我的群聊</h2>
    {% if groups %}
    <div class="list-group">
        {% for group in groups %}
        <a href="{{ url_for('group_detail', group_id=group.id) }}" class="list-group-item list-group-item-action">
            <div class="d-flex justify-content-between">
                <h5>{{ group.name }}</h5>
                <span class="badge bg-primary">
                    {% if group.owner_id == current_user.id %}群主{% else %}成员{% endif %}
                </span>
            </div>
            <small class="text-muted">人数: {{ group.member_count }}/{{ group.max_members }}</small>
        </a>
        {% endfor %}
    </div>
    {% else %}
    <div class="alert alert-info">
        您还没有加入任何群聊，<a href="{{ url_for('create_group') }}">创建一个新群聊</a>
    </div>
    {% endif %}
</div>
{% endblock %}
